import string
import sys
import time
import os
import random

from faker import Faker

BASE_PATH = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(BASE_PATH)

# 定义日志文件路径
LOG_PATH = os.path.join(BASE_PATH, "log")
if not os.path.exists(LOG_PATH):
    os.mkdir(LOG_PATH)

class String_Utils():

    def __init__(self):
        self.fake = Faker("zh_CN")

    def unicode_to_chinese(self,unicode:str):
        '''
        unicode编码转换成中文字符
        '''
        return "{}".format(unicode)

    def generate_random_string(self,number):
        '''
        number的最大值只能是63以内的
        '''
        ran_str = ''.join(random.sample(string.ascii_letters + string.digits, number))
        return ran_str

string_utils = String_Utils()

# if __name__ == '__main__':
#     sting_utils = String_Utils()
#     test_string = '\u767b\u5f55\u4fe1\u606f\u6709\u8bef\uff0c\u8bf7\u68c0\u67e5\u5e76\u91cd\u65b0\u586b\u5199'
#     print(sting_utils.unicode_to_chinese(test_string))
#     test = sting_utils.generate_random_string(63)
#     print(test)
